<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" ></meta>
	<#include "../common.html" />
</head>
<body>
	<div  class="easyui-panel" data-options="fit:true,border:false">
		<form id="newRoleForm" style="margin: 70px 110px;">
			<table>
				<tr>
					<td>角色名</td><td><input type="text" name="name" value="${role.name}" style="width: 173px;" class="easyui-validatebox" data-options="required:true,validType:['length[1,20]']"/></td>
					<input type="hidden" name="unique" value="角色名">
					<input type="hidden" name="id" value="${role.id}">
				</tr>
				<tr>
					<td>排序</td><td><input type="text" name="sort" value="${role.sort}" style="width: 173px;" class="easyui-validatebox" data-options="required:true,validType:['length[1,20]']"/></td>
				</tr>
				<tr>
					<td>描述</td><td><input type="text" name="description" value="${role.description}" style="width: 173px;" class="easyui-validatebox" data-options="required:true,validType:['length[1,20]']"/></td>
				</tr>
				<tr>
					<td>状态</td><td><input type="radio" name="status" value="1" checked/>启用<input type="radio" name="status" value="0"/>禁用</td>
				</tr>

			</table>
		</form>
	<script>
	function submitRole($roleDialog,$roleGrid,$pjq){
		$("input[name=status][value=${role.status}]").attr("checked","checked");
        var form= $("#newRoleForm");
        var isValid = $(form).form('validate');
        
        if(isValid){
        	var data = ns.serializeObject(form);
            $.ajax({
                type : 'post',
                url : '/admin/role/updateRole',
                data :data,
                dataType : 'json',
                success : function(result) {
                    if(result.success){
                        $pjq.messager.alert('提示', result.msg, 'info',function(r){
							$roleDialog.dialog('destroy');
							$roleGrid.datagrid('reload');
         		     	});
                    }else{
                        $pjq.messager.alert('错误',result.msg,'error');
                    }
                }
            });
        }
	}
	</script>
	</div>
</body>
</html>